<?php 

$arrData = $this->arrData;
$arrError = $this->arrError;
$Item = $this->Item;
if(count($arrData) > 0){
	$Item = $arrData;
}

$value_status = 1;
if(isset($arrData['status'])){
	$value_status = $arrData['status'];
}

$name = $this->formText('name',$Item['name'],array('style'=>'width:274px;'));

$picture = $this->formFile('picture');
$picture .= '</br><img style="margin-left: 140px;" src="'. PUBLIC_URL .'/img/product/' . $Item['picture'] . '" width="111" />';

$price = $this->formText('price',$Item['price'],array('style'=>'width:274px;'));
$selloff = $this->formText('selloff',$Item['selloff'],array('style'=>'width:274px;'));
$warranty = $this->formText('warranty',$Item['warranty'],array('style'=>'width:274px;'));
$promotion = '<div style="margin-left: 140px;">'. $this->formTextarea('promotion',$Item['promotion'],array('cols'=>80,'rows'=>10)) .'</div>';
$intro = '<div style="margin-left: 140px;">'. $this->formTextarea('intro',$Item['intro'],array('cols'=>80,'rows'=>10)) .'</div>';

$status = $this->formHidden('status',$Item['status'],array('id'=>'status'));
$order = $this->formText('order',$arrData['order'],array('style'=>'width:274px;'));

$cat_id = $this->formHidden('cat_id',$Item['cat_id']);
$id = $this->formHidden('cat_id',$Item['id']);
$current_picture = $this->formHidden('current_picture',$Item['picture']);

$lnkSubmit = $this->url(array('module'=>'admin','controller'=>'product','action'=>'edit'));
$lnkBack = $this->url(array('module'=>'admin','controller'=>'product','action'=>'index','cat_id'=>$Item['cat_id']));
?>
<div class="content-box">
			<div class="box-body">
				<div class="box-header clear">
					<h2>Add Category</h2>
				</div>
				
				<div class="box-wrap clear">

					<form id="appForm" name="appForm" action="" enctype="multipart/form-data" method="post" class="validate-form form bt-space15">
					
					<div class="columns clear bt-space15">
						<div class="col2-3">
							<!-- Div thong bao loi -->
							<?php if(count($arrError) > 0){
								echo '<div class="notification note-error">
								<a href="#" class="close" title="Close notification">close</a>';
								foreach ($arrError as $key => $val){
							?>
							
								<p><strong><?php echo $key . ': ';?></strong><?php echo $val?></p>
							
							<?php 		
								}
								echo '</div>';
							}?>
							<!-- End div thong bao loi -->
							
							<div class="form-field clear">
								<label for="name" class="form-label size-120 fl-space2">Name: <span class="required">*</span></label>
								<?php echo $name;?>
								<?php
									echo $cat_id;
									echo $id;
									echo $current_picture;
								?>
							</div><!-- /.form-field -->
							
							<div class="form-field clear">
								<label for="parent" class="form-label size-120 fl-space2">Picture: <span class="required">*</span></label>
								<?php echo $picture;?>
							</div><!-- /.form-field -->
							
							<div class="form-field clear">
								<label for="parent" class="form-label size-120 fl-space2">Giá: <span class="required">*</span></label>
								<?php echo $price;?>
							</div><!-- /.form-field -->
							
							<div class="form-field clear">
								<label for="parent" class="form-label size-120 fl-space2">Giảm giá:</span></label>
								<?php echo $selloff;?>
							</div><!-- /.form-field -->

							<div class="form-field clear">
								<label for="parent" class="form-label size-120 fl-space2">Bảo hành:</span></label>
								<?php echo $warranty;?>
							</div><!-- /.form-field -->

							<div class="form-field clear">
								<label for="parent" class="form-label size-120 fl-space2">Khuyến mãi:</span></label>
								<?php echo $promotion;?>
							</div><!-- /.form-field -->

							<div class="form-field clear">
								<label for="parent" class="form-label size-120 fl-space2">Giới thiệu:</span></label>
								<?php echo $intro;?>
							</div><!-- /.form-field -->

							<div class="form-field clear">
								<label for="parent" class="form-label size-120 fl-space2">Chi tiết: </span></label>
								<?php echo '<div style="margin-left: 140px;">'?>
								<?php echo $this->cmsCk('detail',$Item['detail'],array('width'=>800,'height'=>700));
									  //echo $this->cmsFck('detail',$Item['detail'],array('width'=>800,'height'=>700));
								?>
								<?php echo  '</div>';?>
							</div><!-- /.form-field -->

							<div class="form-field clear">
								<label for="status" class="form-label size-120 fl-space2">Status:</label>
								<div id="radio"><?php echo $status;?></div>
								<span class="switch-wrapper small">									
									<span class="switch-enable <?php if($value_status == 1) echo 'selected';?>">Enable</span>
									<span class="switch-disable <?php if($value_status == 0) echo 'selected';?>">Disable</span>
								</span>								
							</div><!-- /.form-field -->							
                                                        							
							<div class="form-field clear">
								<div class="fl-space2"><label for="order" class="form-label size-120">Order:</label> <span id="error-textarea"></span></div>
								<?php echo $order;?>
							</div><!-- /.form-field -->
							</br><button class="green" type="button" onclick="onSubmitForm('appForm','<?php echo $lnkSubmit;?>')">Đồng ý</button>
							<button class="red" type="button" onclick="toSite('<?php echo $lnkBack;?>')">Back</button>	
						</div>
																														
					
					</form>
					
					</div><!-- end of box-wrap -->
			</div> <!-- end of box-body -->
</div>